import { createWebHistory, createRouter } from 'vue-router'

import HomeView from '../views/home/index.vue'
import Login from '../views/login.vue'
//二级路由
import Sy from '../views/home/sy.vue'
import Classify from '../views/home/classify.vue'
import Shopping from '../views/home/shopping.vue'
import My from '../views/home/my.vue'

const routes = [
    { path: '/', redirect: '/home' },
    {
        path: '/login',
        component: Login,
    },
    {
        path: '/home',
        component: HomeView,
        children: [
            { path: '/home', redirect: '/home/classify' },
            {
                path: 'sy',
                component: Sy,
            },
            {
                path: 'classify',
                component: Classify,
            },
            {
                path: 'shopping',
                component: Shopping,
            },
            {
                path: 'my',
                component: My,
            },
        ]
    },
]

const router = createRouter({
    history: createWebHistory(),
    routes,
})
export default router